﻿using RXY_Mall.Core;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace RXY_Mall.AdminApi.Models
{
    #region 基础类
    /// <summary>
    /// 基础信息
    /// </summary>
    public class BaseInput
    {
        /// <summary>
        /// 用户ID
        /// </summary>
        public int user_id { get; set; }
    }
    #endregion
    
    #region 相应类
    /// <summary>
    /// 响应类
    /// </summary>
    /// <typeparam name="T"></typeparam>
    public class Response<T>
    {
        private int _code;
        private string _msg = string.Empty;

        /// <summary>
        /// 状态码
        /// 0：错误
        /// 1：正确
        /// 2：异常
        /// 3: 权限不足
        /// </summary>
        public int code
        {
            get { return _code; }
            set { _code = value; }
        }

        /// <summary>
        /// 操作信息
        /// </summary>
        public string msg
        {
            get { return _msg; }
            set { _msg = value; }
        }

        /// <summary>
        /// 返回数据
        /// </summary>
        public T data { get; set; }
    }

    /// <summary>
    /// 回复状态
    /// </summary>
    public enum StatusCodeEnum
    {
        /// <summary>
        /// 失败
        /// </summary>
        [Text("请求(或处理)失败")]
        FAILURE = 0,
        /// <summary>
        /// 成功
        /// </summary>
        [Text("请求(或处理)成功")]
        SUCCESS = 1,
        /// <summary>
        /// 内部错误
        /// </summary>
        [Text("内部请求出错")]
        ERROR = 2,
        /// <summary>
        /// 签名错误
        /// </summary>
        [Text("签名错误")]
        ACCESSVIOLATION = 3,
    }
    #endregion
    
    /// <summary>
    /// token
    /// </summary>
    public class Token
    {
        /// <summary>
        /// 用户名
        /// </summary>
        public int user_id { get; set; }

        /// <summary>
        /// 用户名对应签名Token
        /// </summary>
        public string sign_token { get; set; }

        /// <summary>
        /// Token过期时间
        /// </summary>
        public DateTime expire_time { get; set; }
    }
}